<div id="editinfo-example"></div>
<div class="header">
<p>
Up: [[cvs: Editinfo#Editinfo|editinfo]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Editinfo-example"></div>
===== Editinfo example =====

The following is a little silly example of a
&lsquo;<tt>editinfo</tt>&rsquo; file, together with the corresponding
&lsquo;<tt>rcsinfo</tt>&rsquo; file, the log message template and an
editor script.  We begin with the log message template.
We want to always record a bug-id number on the first
line of the log message.  The rest of log message is
free text.  The following template is found in the file
&lsquo;<tt>/usr/cvssupport/tc.template</tt>&rsquo;.

<div class="example" style="margin-left: 3.2em">
 BugId:
</div>

The script &lsquo;<tt>/usr/cvssupport/bugid.edit</tt>&rsquo; is used to
edit the log message.

<div class="example" style="margin-left: 3.2em">
 #!/bin/sh
 #
 #       bugid.edit filename
 #
 #  Call $EDITOR on FILENAME, and verify that the
 #  resulting file contains a valid bugid on the first
 #  line.
 if <nowiki>[</nowiki> &quot;x$EDITOR&quot; = &quot;x&quot; <nowiki>]</nowiki>; then EDITOR=vi; fi
 if <nowiki>[</nowiki> &quot;x$CVSEDITOR&quot; = &quot;x&quot; <nowiki>]</nowiki>; then CVSEDITOR=$EDITOR; fi
 $CVSEDITOR $1
 until head -1|grep '^BugId:<nowiki>[</nowiki> <nowiki>]</nowiki>*<nowiki>[</nowiki>0-9<nowiki>][</nowiki>0-9<nowiki>]</nowiki>*$' &lt; $1
 do  echo -n  &quot;No BugId found.  Edit again? (<nowiki>[</nowiki>y<nowiki>]</nowiki>/n)&quot;
     read ans
     case $<nowiki>{</nowiki>ans<nowiki>}</nowiki> in
         n*) exit 1;;
     esac
     $CVSEDITOR $1
 done
</div>

The &lsquo;<tt>editinfo</tt>&rsquo; file contains this line:

<div class="example" style="margin-left: 3.2em">
 ^tc     /usr/cvssupport/bugid.edit
</div>

The &lsquo;<tt>rcsinfo</tt>&rsquo; file contains this line:

<div class="example" style="margin-left: 3.2em">
 ^tc     /usr/cvssupport/tc.template
</div>

This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
